package main

import (
	"strings"
	"fmt"
)

func main() {

	res := strings.Contains("hellogo", "go")
	fmt.Println(res) // true false
	res2 := strings.Index("hellogo", "o")
	fmt.Println(res2) // 4

	res3 := strings.Fields(" are u   ok ?    ") // 根据空格拆分（多个空格当做一个空格处理）
	for index, data := range res3 {
		fmt.Println(res3, index, data)
	}
	res4 := strings.Trim("? are u ok ?", "?")
	fmt.Println(res4)

	res5 := strings.Join(res3, "@")
	fmt.Println(res5)

	res6 := strings.Split("abbccdde", "b")
	// split 过程中bb 当做两个
	for index, data := range res6 {
		fmt.Println(index, data, len(data))
	}

	res7 := strings.Repeat("hello ", 3)
	fmt.Println(res7) // hello hello hello


	res8 := strings.Replace("hello", "ll", "LL", -1)
	// 0 都为替换0个 <0 为替换所有
	fmt.Println(res8)

}
